<?php
class Xigg_Model_CommentForm extends Xigg_Model_CommentFormBase
{
    function _onInit()
    {
        // forllowing properties should not be changed via form
        $this->removeElements(array('Parent', 'body_cache'));
        $this->validatesPresenceOf('title', _('You must enter title for the comment'));
        $this->validatesPresenceOf('body', _('You must enter something to comment'));
        // set content_syntax options
        $status =& $this->getElement('content_syntax');
        $status->addOption('HTML', 'HTML');
    }

    function _onEntity(&$entity)
    {
        // things that should be applied to a specific entity form should come here
        if ($entity->getId() <= 0) {
            // set default content syntax for new entity to HTML_AutoFormat
            $this->setValueFor('content_syntax', 'HTML_AutoFormat');
        }
    }
}